import { Tag } from 'ant-design-vue';
import type { TableColumn } from '@/components/core/dynamic-table';

export type DeptListItem = API.DeptListPageResultItem;
export type TableColumnItem = TableColumn<DeptListItem>;

export const baseColumns: TableColumnItem[] = [
  {
    title: '部门ID',
    dataIndex: 'id',
    hideInTable: true,
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '部门名称',
    dataIndex: 'name',
    align: 'center',
  },
  {
    title: '部门编码',
    align: 'center',
    hideInSearch: true,
    dataIndex: 'code',
  },
  {
    title: '部门简称',
    hideInSearch: true,
    align: 'center',
    dataIndex: 'shortName',
  },
  {
    title: '所属机构',
    dataIndex: 'orgId',
    hideInTable: true,
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '所属机构',
    dataIndex: 'orgName',
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '部门电话',
    dataIndex: 'phoneNumber',
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '上级部门ID',
    dataIndex: 'parentId',
    hideInTable: true,
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '上级部门',
    dataIndex: 'parentName',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
  {
    title: '上级部门领导ID',
    hideInTable: true,
    dataIndex: 'parentLeader',
    hideInSearch: true,
    
    align: 'center',
  },
  {
    title: '上级部门领导',
    dataIndex: 'parentLeaderName',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
  {
    title: '部门领导ID',
    dataIndex: 'deptLeader',
    hideInTable: true,
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '部门领导',
    dataIndex: 'deptLeaderName',
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '邮寄地址',
    dataIndex: 'postAddress',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
  {
    title: '主岗位',
    dataIndex: 'mainPost',
    hideInTable: true,
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '职务',
    dataIndex: 'staff',
    hideInTable: true,
    hideInSearch: true,
    align: 'center',
  },
  {
    title: '是否启用',
    dataIndex: 'IS_ENABLED',
    align: 'center',
    hideInSearch: true,
    formItemProps: {
        component: 'Select',
        componentProps: {
          options: [
            {
              label: '是',
              value: 1,
            },
            {
              label: '否',
              value: 0,
            },
          ],
        },
      },
      customRender: ({ record }) => {
        const isEnable = record.IS_ENABLED === 1;
        return <Tag color={isEnable ? 'success' : 'red'}>{isEnable ? '是' : '否'}</Tag>;
      },
  },
  {
    title: '是否业务相关',
    dataIndex: 'IS_BUSINESS',
    align: 'center',
    hideInSearch: true,
    formItemProps: {
        component: 'Select',
        componentProps: {
          options: [
            {
              label: '是',
              value: 1,
            },
            {
              label: '否',
              value: 0,
            },
          ],
        },
      },
      customRender: ({ record }) => {
        const isEnable = record.IS_ENABLED === 0;
        return <Tag color={isEnable ? 'success' : 'red'}>{isEnable ? '是' : '否'}</Tag>;
      },
  },
  {
    title: '机构标签',
    dataIndex: 'orgTags',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
  {
    title: '关键字',
    dataIndex: 'keyWords',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
  {
    title: '排序号',
    dataIndex: 'orgSort',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
  {
    title: '备注',
    dataIndex: 'remark',
    hideInSearch: true,
    hideInTable: true,
    align: 'center',
  },
];
